<template>
  <div class="attend_steps">
    <div v-if="stepList.length">
      <div v-for="(item, index) in stepList" :key="index">
        <div class="steps_title">
          <div class="steps_tit_circle" :class="{ is_success: item.approveStatus == '1' }">
            {{ index + 1 }}
            <van-icon v-if="item.approveStatus == '1'" class="select_circle" name="checked" />
          </div>
          <div class="steps_tit_r">
            <p>{{ item.noteName }}</p>
            <p class="steps_tit_time">{{ item.approveTime }}</p>
          </div>
        </div>
        <div class="steps_content">
          <div class="steps_content_cont" :class="stepList.length != index + 1 ? 'steps_lines' : 'steps_lines_no'">
            <div v-if="item.userName">
              执行人：
              <span class="des_name">{{ item.userName }}</span>
            </div>
            <div
              v-if="item.approveContent || item.approveType"
              class="steps_content_quest"
              :class="{ item_red: item.approveType == '审批不通过' }">
              {{ item.approveType }}
              <span v-if="item.approveContent">：{{ item.approveContent }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <van-loading v-if="loading" />
  </div>
</template>

<script>
import { getFlowApproveListExpense } from '@api/api-dailyManage.js'
export default {
  components: {},
  props: {
    approveFlow: {
      type: Object,
      default() {
        return {}
      },
    },
  },
  data() {
    return {
      stepList: [],
      loading: false,
    }
  },
  created() {},
  mounted() {
    this.loading = true
    setTimeout(() => {
      this.getFlow()
    }, 1000)
  },
  methods: {
    getFlow() {
      getFlowApproveListExpense({
        id: this.approveFlow.id,
        processInstanceId: this.approveFlow.processInstanceId,
      }).then(res => {
        this.loading = false
        this.stepList = res.data
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.attend_steps {
  font-size: 12px;
  color: #333;
  .steps_title {
    display: flex;
    height: 20px;
    .steps_tit_circle {
      height: 20px;
      width: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
      border: 2px solid #c8c9cc;
      position: relative;
    }
    .is_success {
      border-color: #409eff;
    }
    .select_circle {
      color: #67c23a;
      display: inline-block;
      position: absolute;
      top: 10px;
      left: 10px;
      font-size: 12px;
    }
    .steps_tit_r {
      margin-left: 5px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex: 1;
    }
    .steps_tit_time {
      color: #909399;
    }
  }
  .steps_content {
    min-height: 35px;
    display: flex;
    .steps_content_line {
      height: 100%;
      min-height: 35px;
      width: 30px;
      display: flex;
      justify-content: center;
      .line_one {
        height: 100%;
        min-height: 35px;
        width: 2px;
        background-color: #409eff;
        display: inline-block;
      }
    }
    .steps_lines {
      border-left: 2px solid #409eff;
      min-height: 35px;
      margin-left: 8px;
      padding-left: 15px;
    }
    .steps_lines_no {
      margin-left: 25px;
    }
    .steps_content_cont {
      flex: 1;
      height: 100%;
      .item_red {
        color: #f56c6c;
      }
      .des_name {
        color: #3863a3;
      }
      .steps_content_quest {
        margin-top: 5px;
        border: 1px solid #ececec;
        padding: 5px 7px;
        background-color: #e4ebf0;
        position: relative;
        word-break: break-all;
        &::after {
          content: ' ';
          position: absolute;
          top: -18px;
          left: 10px;
          width: 0;
          height: 0;
          border-top: 8px solid transparent;
          border-left: 10px solid transparent;
          border-right: 10px solid transparent;
          border-bottom: 10px solid #e4ebf0;
        }
      }
    }
  }
  .van-loading {
    text-align: center;
  }
}
</style>
